@echo off
title Property Cleaning System - Environment Check
color 0A
echo.
echo ================================================
echo   Property Cleaning System Environment Check
echo ================================================
echo.

REM Check system info
echo Checking system information...
systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Type"
echo.

REM Check Git
echo Checking Git...
git --version >nul 2>&1
if %errorLevel% neq 0 (
    echo [ERROR] Git is not installed
) else (
    echo [OK] Git is installed
    git --version
)
echo.

REM Check Docker
echo Checking Docker...
docker --version >nul 2>&1
if %errorLevel% neq 0 (
    echo [ERROR] Docker is not installed
) else (
    echo [OK] Docker is installed
    docker --version
    
    REM Check Docker service
    docker info >nul 2>&1
    if %errorLevel% neq 0 (
        echo [WARNING] Docker is installed but not running
    ) else (
        echo [OK] Docker service is running
    )
)
echo.

REM Check Java
echo Checking Java...
java -version >nul 2>&1
if %errorLevel% neq 0 (
    echo [ERROR] Java is not installed
) else (
    echo [OK] Java is installed
    java -version
)
echo.

REM Check Node.js
echo Checking Node.js...
node --version >nul 2>&1
if %errorLevel% neq 0 (
    echo [ERROR] Node.js is not installed
) else (
    echo [OK] Node.js is installed
    node --version
    npm --version
)
echo.

REM Check ports
echo Checking ports...
netstat -ano | findstr :3000 >nul
if %errorLevel% neq 0 (
    echo [OK] Port 3000 is available
) else (
    echo [WARNING] Port 3000 is in use
)

netstat -ano | findstr :8080 >nul
if %errorLevel% neq 0 (
    echo [OK] Port 8080 is available
) else (
    echo [WARNING] Port 8080 is in use
)
echo.

REM Check project files
echo Checking project files...
if exist "docker-compose.yml" (
    echo [OK] docker-compose.yml found
) else (
    echo [ERROR] docker-compose.yml not found
)

echo.
echo ================================================
echo Environment check completed!
echo ================================================
pause